// Copyright (c) 2005  INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of cgal-python; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; version 2.1 of the License.
// See the file LICENSE.LGPL distributed with cgal-python.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: Py_Triangle_3.cpp 167 2007-11-02 15:36:54Z spion $
// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal-python/trunk/cgal-python/bindings/Kernel/Py_Triangle_3.cpp $
//
// Author(s)     : Naceur Meskini
//=========================================================================

#include <CGAL/basic.h>
#include <include/Kernels.h>

#include <boost/python.hpp>
#include <boost/cstdint.hpp>

const char* Triangle_3_doc[] ={
"\
An object t of the class Triangle_3 is a triangle in the three-dimensional Euclidean space. \n\
As the triangle is not a full-dimensional object there is \n\
only a test whether a point lies on the triangle or not.\n\
For more details see a C++ documentation:\n\
http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Kernel_23_ref/Class_Triangle_3.html",

"\
t = Triangle_3( Point_3 p, Point_3 q , Point_3 r)\n\
introduces a triangle t with vertices p, q and r.",

"t.supporting_plane () -> Plane_3\n\
returns the supporting plane of t, with same orientation.",

"t.transform (Aff_transformation_3 t) -> Triangle_3\n\
returns the triangle obtained by applying at on the three vertices of t",

"v.has_on ( Point_3) -> bool\nA point is on t, if it is on a vertex, an edge or the face of t.",

"t.is_degenerate () -> bool\nt is degenerate if its vertices are collinear.",

"t.vertex ( int i) -> Point_3\nreturns the i'th vertex modulo 3 of t.",

"t.bbox () -> Bbox_3\nreturns a bounding box containing t.",

"v.squared_area () -> returns a square of the area of t."
};

template<class Triangle_3>
boost::python::str py_repr_Triangle_3(const Triangle_3& t )
{
	using namespace boost::python;
	return str("Triangle_3("+ str(t.vertex(0)) +","+ str(t.vertex(1)) + "," + str(t.vertex(2)) +")" );
}

template <class kernel > 
void Py_Triangle_3()
{
	typedef typename kernel::Point_3 						Point_3;
 	typedef typename kernel::Triangle_3 						Triangle_3;

	using namespace boost::python;

        class_< Triangle_3 >("Triangle_3", Triangle_3_doc[0],init<  >())
        .def(init< const Triangle_3& >(Triangle_3_doc[1]))
        .def(init< const Point_3&, const Point_3&, const Point_3& >())
        .def("supporting_plane", &Triangle_3::supporting_plane, Triangle_3_doc[2])
        .def("transform", &Triangle_3::transform, Triangle_3_doc[3])
        .def("has_on", &Triangle_3::has_on, Triangle_3_doc[4])
        .def("is_degenerate", &Triangle_3::is_degenerate, Triangle_3_doc[5])
        .def("vertex", &Triangle_3::vertex, BEF_33(by_cref, by_copy)(), Triangle_3_doc[6])
        .def("bbox", &Triangle_3::bbox, Triangle_3_doc[7])
        .def("squared_area", &Triangle_3::squared_area, Triangle_3_doc[8])
	.def("__repr__", &py_repr_Triangle_3<Triangle_3>)

        .def( self == self )
        .def( self != self )
    ;
}

void export_Triangle_3()
{
	Py_Triangle_3<K>();
}
